Fix layout mapping and add a simple test