Add check for n == 0, so the assert passes.