More defensive create_buf
Use unicode in python 2