Fixed save functionality