Fix db bugs that prevent saving.