Replace .delegate with .on

I replaced .delegate with .on as a fix to Issue #395.