Fix + golf

The function didn't properly.
Test case : it was impossible to run it twice in a row.
Merge pull request #146 from Nickdouille/patch-1

Fix + golf