fixed Safari and Firefox JS issues