fixing error in .click function