Fix CustomEvent detection