Fix memory problem

We need to add a null character at the end of the element to avoid
reading outside the string limits

Change-Id: Ic88383f81c0edad21c74d68d95774b7d464b339b