fixed bug for newer versions of jquery