fix data-flow bugs