Some minor fixes to make it work in Safari