Fix bug: isValidKey() and isValidTrigger()