Support for plain pkg files

Should fix #839 and #1043