Correcting work loss

I put back some of the code that was squizzed when you rebased from last changes by @GuillaumeGomez last PR #162.