Fixed logic in backwards compat loop