Fix a regression breaking pkg convert
Add tests for the regression