add py2 support, catch decodeError