fixed recursive bug during memory transfer