fixes #35, various other fixes added