fix unicode issue on cleanup

Still not quite right
Comedy poc

Needs some tidying up but the 'stable' code no longer works