fixed problem with sorting problems