Fixes for unit tests and compilation