Fix + unit test for the bug 697

Only keep the commits done today (March 28th). The rest is useless.