fix #8497, evaluate staged functions in the correct module