Fixes port sorting issues.