changed the code to fix Js error in FF