Fix self assignment branch explosion

Fixes #552.