fixed some code with diversity