Fix template and layout mapping