Added compatability for python3