More repository tests and fixes