worked out bugs in the click handling