Fix bug about config option "history_releases_count", sometimes would not remove all releases not need anymore