sorted set tests

• added tests for sorted sets
• fixed bugs that the tests revealed