fix a bug for null value; output query statement before result; handle the case for null getResultSet