Various JS fixes

Attempt to get some IE compatibilty

Change-Id: If74a3c24447865e45f9feadb8dbbcb1249079ce3