Fixed dual python2/python3 compatibility