python3 compatibility code wrt issue #24