more performant check for empty layers