Fixed issue with sorting