Changed ObstacleBag to avoid infinite loops and broken empty behaviour.