change build() to encode()