cherry pick from working template