Hotfix/baderrorwriting

Fixes problems noted by Lel on the dev mailing list.