fix key check