Added a functional test for label recovery.

The bug is already fixed in earlier commits, so this is just another test
for confidence and regression ensurance.