add __init__.py to use as package
some code improvements
fix error that raises because of the new API changes