fixed bug in bag recording