> If I understand correctly, alpha is a (1, 1) array that is a slice to alphas.

OK, so if this is indeed the case, your fix will work.

> alphas is never updated as far as I can see, only alpha.
> I am not sure why it is done this way.

Me neither :(