fix some errors
improved python detection