fix algorithm for draining solution