sort bounds fixes and tests #62 tasks