fixes #22, fixes #13, fixes #8