Fixed a bug that made javascript crash in other browsers