manually handle uncaught exceptions

as this can provide better error reporting
support camel case filenames