sandbox: Correct maths in allocation routines