Fixing allowed keys check logic.