fixed scope error with jQuery