some script optimization