check if con != NULL before using it