Fix database test for sorted objects