fixed wrong condition in error check