merge #186 into bugfree branch