fixes #295 and fixes #300