Fix js error (silly me) and workaround some crazy bug in firefox