Fixed a bug with browser that don't support attachEvent or addEventListener