Fix bug with adding properties and events handlers