Hopefully fixed an overflow bug for chunk calculation.