fixes #261 and fixes #163