fixing wrong scope on event handler