fix immediately-executing function