Make saving more robust