fixed a bug if sorting isn't defined