[PROF-103] Fix layer detection and profiling.