Fixed some sorting issues.