fixing js to work with firefox