update bag implementation