Add more error checking and exit code. (fixes #37 on github)