fix database save errors