Fix some repository bugs