fix logical problem