Fix init

fix issue #42 and some cleanup