Improved browser compatibility

Tested on Chrome 36, IE 11, Opera 23, Firefox 30 and 31