[WritingCalculations] Fixed Upgrade Model function for backward compatibility. Added test case.