fixed various cross-browser bugs