Fix python issues to pass tests