Fixed encoding problem on labels with queries
Small refactoring