Fixing diffusion overflows and bugs