several fixes for cmake build