fixed invalid js calls; now works with latest jquery