add flexible entities encoding/decoding