Build and exit code bug fixes