Fix updating phis from stack values in frontend (fix nested loops)