fix an error in retrieving sql result