better error message and exit code