Fix the runtime error with CreatingLayout