added permissions check, fixed a NPE when the queue sorter is null