Revert "Simplified previous patch."

This reverts commit 582adb9d9e5193206e3a3a9a244c0d2b7ac4b2a0.
Revert "Use the COP_FLAG_UPDATE/FINAL flags. Patch by Glenn Schmottlach."

This reverts commit 9d1ef57a8c9206fcedf4f0def2260d10436d43a2.
updated