add debug flag for each stage