Merge "Fix unsafe layer hierarchy access" into main