fix key check giving false positives