Fix bugs in interpretation of repository format 2.