Re-add db write functionality lost on revert