progress in attempting to fix save function