Various fixes to run unit tests