Bugfixes for #76 and #79