fix bugs with sorting, maybe?