Minor fixes

Fixed minor issue with sorting