fixes a bug that it fails if pkg.main does not exist; #9