handle when encode is called with binary