Save and restore database node_id when saving and loading workflow;
various fixes in getting unit tests running.