fix for #830

Maybe a bit dirty, I'm not fond of jQuery.