major logic fix