Fixed stage ref bug