fixed potential integer overflow