changed save implementation