Fixes setEvents method and event objects in template

Nice module, thanks! Spotted two bugs though which I fixed in the two commits you find below.