fix bytebuffer and self-define method