Some changes to make discovery work with python3