fixes for better sorting