check the rm return code