Fix bugs raise by the unittests when several codebases are used