added validity check for connection handle