bug fixes for saving