Issue #1870300 by blairski, stefan.r: Added workaround for core bug which can cause upgrade from Flag 2.x to Flag 3.x to fail.