use six to deal with python2 bytes, and fix test regression