Unit test bugfixes for aa1f42517ee42e8d17641f5aeef6f4c48a35fd44