added Python3 compatibility