This is parse order dependent. ensure_resources() would be a better approach.