fixing logic in the enhanceparameters function