use global jquery and minor fix