Fix test and added compatibility with python3