Fix #155 and more work on #109