bugfixes for #222