difficulty calling save function