fixed bug with the distribute method