Fixed race conditions for layout cache initialization