relaxed guard a bit as function names are not yet standard
fixed double comments by unregistering event handlers first and then registering them anew