prepare setup.py and some fixes to helper functions