added Fix_flagged and fix_segment; updated Assign_layers, STOP_compare,fix_w_DEM