handle auto commit correctly