logic fix