Why this part is not working correctly