more error handling and checking if there's any data to save before saving