adds check for exit code, just in case