Fix bug with old resources not being removed