fixed exist return code check