fixed warnings (and potential errors) due to integer overflow when