fix db transaction bug