Fixes regression in the cleanup

Regressed in #4815