fix get_structure_element_layer_id(). Add regression test.