Fix js bug in firefox