fixed #387 : indentation changes and event handling