finally fixed the saving issues