fixed issue with data not saving properly