fix runtime error in some environment