Improvements in repository state handling