Fixed call to encode()