added try-catch to package.js so that it can be used as not a package as well