improve python api and examples, diverse fixes