fixes bug in DatabaseCursor::next