Fixed an issue with database saving