Move flush check out of the tight loop