Fix cross-browser compatibility bugs