fixes #323, and #322