Fix a bug in getting error status when no error happens