fix commonjs require throwing error by wrapping in try-catch (fixes #39)