changes for compatibility with jQuery < 1.6