refactoring ResultSet

optimize some methods
fix buffering