fixes #59 + other small bugfixes