improve error and debug messages
lazy require prettyjson