Drop console.log statements.
Use find() instead of has().

For some subtle reason the one works and the other does not. Possibly
a bug in has().