Resolve bug with 3.x

Fixed integer issues in python 3.x because of PEP 238