fix on click function