Do not register hooks and eventhandlers twice, closes #727, closes #484.