Fixed important bug when retrieving ResultSets