Fixed rewrite to work in browser again.