Save profile encoding correctly.

I have added a private variable where we save the encoding. The
problem was what out of the property body the return value memory
was not allocated. This fixes #27.