Bind the events correctly