Move update debug closer to actual write.
Merge pull request #183 from jrconlin/dev

Move update debug closer to actual write.