fix js to work in firefox