Fixed another sorting bug (hopefully, for the last time)