Fixed bad check for key