Fix key validation