bugfixes for earlier untested work