Fix uri check logic