catch a few exceptions in the main program
add support for linux