close #59 + various other fixes