Fixing saving functionality