move some check upstream to save some time in flow