Fix init

fix issue #41 and some cleanup