bug with sorting