added edit-op matrix to properly handle backtrace of nontrivial cost functions