Fixed issues with event binding