Fixes #580
Fixes #581