Fix for sorting