Labels enc bugfix2

I tested the solution proposed by Eric and prepered this new pull request.