Sort requirements, fix #1031.