fix this piece of junk to work with newer jquery