Hopefully fixed an integer overflow bug