fixes #39, fixes #40