Fix bug 61516: when copying cells with formulas we should properly check for references that are invalid afterwards.