Should fix #175, but needs some testing on IE