Fixed the use of bytes and strings to be Python3 compatible.