Added tests for ResultSetSelect and fixed bugs