Fixes save functionality