Fixing save function.