some cleanup to events and fixed issue in IE when not compiled in advanced