fixed some issues with saving