Fix key toggle bug