More error handling/reporting. OS X portability (program_invocation_short_name not defined?).