avoid int overflows