made it compatible with older jquery version