improved exception handling and added abort to get a coredump