fix in the second part of the logic
fix in the second part of the logic