Fix checkKey bugs