jquery tweak to eliminate refresh bug