encoding works for simple case