Fixed several occurrences where the CUM_RETVALS global was not declared in a function.