Fixes the save function.