bug fixes in unit tests