some js optimization