Fixed iteration bug in __expire_all_if_necessary()