Restore API check for setCompressedLayoutHeirarchy

Fix #2513