bugfixes in recent PR merge