Fix incorrect placing of encoding function due to failing test.