Lot of fixes, most of them without issue on Github. Also fixes #5, #7