fixed minor issue with sorting