Fixes #324, fixes #323