encode fix in rest controllers