fixed typo with key check