Fixes onclick event handling