fix issue with sorting