Fixes end to not fire "end" event twice.