sort fix, category fix

fixes #66 and fixes #65