Fixed errors encoding (f-me/carma#414)