[flow] minor code optimization improvements