(sort) Improved tests and solved bug