optimize the build flow