Fix error by wrong check order