Persistent RAFT state and bugfixes