Make sure we cast integers as ints, so they don't overflow