Sometimes workers tries to write its phase when the phase iterator is al...

...ready reached its end and the phase is null. This should fix it