fixes #40 and fixes #41 and fixes #45