bag implementation fix