fixed scoping issue for event handlers