add multistage support