fix check logic