More fixes for rewritten upgrade functions.