Fix key check