fix for `checkKey` so we dont try to call indexOf on invalid type