avoid some undefined behavior