checkbox and sorting partially working