Index: src/uk/me/parabola/mkgmap/osmstyle/actions/EchoAction.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/actions/EchoAction.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/osmstyle/actions/EchoAction.java	(working copy)
@@ -16,6 +16,7 @@
 package uk.me.parabola.mkgmap.osmstyle.actions;
 
 import uk.me.parabola.mkgmap.reader.osm.Element;
+import uk.me.parabola.mkgmap.reader.osm.FakeIdGenerator;
 
 /**
  * Sends a message to the console.
@@ -31,7 +32,7 @@
 
 	public boolean perform(Element el) {
 		String e = value.build(el, el);
-		System.err.println(el.getId() + ": " + e);
+		System.err.println(el.getId() + (FakeIdGenerator.isFakeId(el.getId()) ? " (" + el.getOriginalId() + ")" : "") + ": " + e);
 		return false;
 	}
 }
Index: src/uk/me/parabola/mkgmap/osmstyle/actions/EchoTagsAction.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/actions/EchoTagsAction.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/osmstyle/actions/EchoTagsAction.java	(working copy)
@@ -14,6 +14,7 @@
 package uk.me.parabola.mkgmap.osmstyle.actions;
 
 import uk.me.parabola.mkgmap.reader.osm.Element;
+import uk.me.parabola.mkgmap.reader.osm.FakeIdGenerator;
 
 /**
  * Sends a message including the tags of an element to System.err.
@@ -29,7 +30,7 @@
 
 	public boolean perform(Element el) {
 		String e = value.build(el, el);
-		System.err.println(el.getId() + " - " + el.toTagString()+" " + e);
+		System.err.println(el.getId() + (FakeIdGenerator.isFakeId(el.getId()) ? " (" + el.getOriginalId() + ")" : "") + " - " + el.toTagString()+" " + e);
 		return false;
 	}
 	
Index: src/uk/me/parabola/mkgmap/reader/osm/CoastlineFileLoader.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/CoastlineFileLoader.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/CoastlineFileLoader.java	(working copy)
@@ -178,7 +178,8 @@
 		Collection<Way> ways = new ArrayList<Way>();
 		for (CoastlineWay w : coastlines) {
 			if (w.getBbox().intersects(bbox)) {
-				Way x = new Way(FakeIdGenerator.makeFakeId(), w.getPoints());
+				Way x = new Way(w.getOriginalId(), w.getPoints());
+				x.setFakeId();
 				x.addTag("natural", "coastline");
 				ways.add(x);
 			}
Index: src/uk/me/parabola/mkgmap/reader/osm/Element.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/Element.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/Element.java	(working copy)
@@ -25,6 +25,7 @@
 public abstract class Element {
 	private Tags tags;
 	private long id;
+	private long OriginalId;
 
 	public int getTagCount() {
 		return (tags == null ? 0 : tags.size());
@@ -170,10 +171,19 @@
 		return id;
 	}
 
+	public long getOriginalId() {
+		return OriginalId;
+	}
+
 	protected void setId(long id) {
 		this.id = id;
+		OriginalId = id;
 	}
 
+	public void setFakeId() {
+		id = FakeIdGenerator.makeFakeId();
+	}
+	
 	public String toTagString() {
 		if (tags == null)
 			return "[]";
Index: src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java	(working copy)
@@ -260,8 +260,8 @@
 			double dist = firstPoint.distance(cutPoint);
 			if (dist <= maxLength) {
 				// create a new way with the first two points and identical tags
-				Way precedingWay = new Way(FakeIdGenerator.makeFakeId(), w
-						.getPoints().subList(0, 1 + 1));
+				Way precedingWay = new Way(w.getOriginalId(), w.getPoints().subList(0, 1 + 1));
+				precedingWay.setFakeId();
 				precedingWay.copyTags(w);
 
 				saver.addWay(precedingWay);
@@ -325,7 +325,8 @@
 				
 				// create the new way with identical tags
 				w.getPoints().add(i,cConnection);
-				Way  precedingWay = new Way(FakeIdGenerator.makeFakeId(), new ArrayList<Coord>(w.getPoints().subList(0, i+1)));
+				Way  precedingWay = new Way(w.getOriginalId(), new ArrayList<Coord>(w.getPoints().subList(0, i+1)));
+				precedingWay.setFakeId();
 				precedingWay.copyTags(w);
 				
 				saver.addWay(precedingWay);
Index: src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java	(working copy)
@@ -142,7 +142,8 @@
 				Coord mpCenter = ((MultiPolygonRelation) r).getCofG();
 				if (mpCenter != null && saver.getBoundingBox().contains(mpCenter)){
 					// create a fake node for which the bounds information is collected
-					Node mpNode = new Node(FakeIdGenerator.makeFakeId(), mpCenter);
+					Node mpNode = new Node(r.getOriginalId(), mpCenter);
+					mpNode.setFakeId();
 					processElem(mpNode);
 					// copy the bounds tags back to the multipolygon
 					for (String boundsTag : BoundaryQuadTree.mkgmapTagsArray) {
Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java	(working copy)
@@ -1105,7 +1105,8 @@
 		// This enables the style file to decide if the polygon information or
 		// the simple line information should be used.
 		for (Way orgOuterWay : outerWaysForLineTagging) {
-			Way lineTagWay =  new Way(FakeIdGenerator.makeFakeId(), orgOuterWay.getPoints());
+			Way lineTagWay =  new Way(getOriginalId(), orgOuterWay.getPoints());
+			lineTagWay.setFakeId();
 			lineTagWay.addTag(STYLE_FILTER_TAG, STYLE_FILTER_LINE);
 			lineTagWay.addTag(MP_CREATED_TAG, "true");
 			for (Entry<String,String> tag : outerTags.entrySet()) {
@@ -1555,8 +1556,9 @@
 		List<Way> cuttedOuterPolygon = new ArrayList<Way>(finishedAreas.size());
 		Long2ObjectOpenHashMap<Coord> commonCoordMap = new Long2ObjectOpenHashMap<>();
 		for (Area area : finishedAreas) {
-			Way w = singularAreaToWay(area, FakeIdGenerator.makeFakeId());
+			Way w = singularAreaToWay(area, getOriginalId());
 			if (w != null) {
+				w.setFakeId();
 				// make sure that equal coords are changed to identical coord instances
 				// this allows merging in the ShapeMerger
 				// TODO: maybe better merge here?
@@ -2201,7 +2203,8 @@
 		// This enables the style file to decide if the polygon information or
 		// the simple line information should be used.
 		for (Way orgOuterWay : outerWaysForLineTagging) {
-			Way lineTagWay =  new Way(FakeIdGenerator.makeFakeId(), orgOuterWay.getPoints());
+			Way lineTagWay =  new Way(getOriginalId(), orgOuterWay.getPoints());
+			lineTagWay.setFakeId();
 			lineTagWay.addTag(STYLE_FILTER_TAG, STYLE_FILTER_LINE);
 			lineTagWay.addTag(MP_CREATED_TAG, "true");
 			for (Entry<String,String> tag : tags.entrySet()) {
@@ -2369,8 +2372,9 @@
 		private Rectangle bounds;
 
 		public JoinedWay(Way originalWay) {
-			super(FakeIdGenerator.makeFakeId(), originalWay.getPoints());
-			this.originalWays = new ArrayList<Way>();
+			super(originalWay.getOriginalId(), originalWay.getPoints());
+			setFakeId();
+			originalWays = new ArrayList<Way>();
 			addWay(originalWay);
 
 			// we have to initialize the min/max values
Index: src/uk/me/parabola/mkgmap/reader/osm/POIGeneratorHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/POIGeneratorHook.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/POIGeneratorHook.java	(working copy)
@@ -325,7 +325,8 @@
 	}
 
 	private static Node createPOI(Element source, Coord poiCoord, short poiTypeTagKey) {
-		Node poi = new Node(FakeIdGenerator.makeFakeId(), poiCoord);
+		Node poi = new Node(source.getOriginalId(), poiCoord);
+		poi.setFakeId();
 		poi.copyTags(source);
 		poi.deleteTag(MultiPolygonRelation.STYLE_FILTER_TAG);
 		poi.addTag(poiTypeTagKey, "true");
Index: src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java	(revision 3415)
+++ src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java	(working copy)
@@ -480,7 +480,8 @@
 			return;
 		if (way.hasIdenticalEndPoints()){
 			// add a copy of this way to be able to draw it as a shape
-			Way shapeWay = new Way(FakeIdGenerator.makeFakeId(), way.getPoints());
+			Way shapeWay = new Way(way.getOriginalId(), way.getPoints());
+			shapeWay.setFakeId();
 			// change the tag so that only special rules looking for it are firing
 			shapeWay.deleteTag("natural"); 
 			shapeWay.addTag("mkgmap:removed_natural",naturalVal); 
@@ -676,7 +677,7 @@
 						for (Way w : seaPrecompWays) {
 							// set a new id to be sure that the precompiled ids do not
 							// interfere with the ids of this run
-							w.setId(FakeIdGenerator.makeFakeId());
+							w.setFakeId();
 
 							if ("land".equals(w.getTag("natural"))) {
 								landWays.add(w);
@@ -831,7 +832,8 @@
 					if (FakeIdGenerator.isFakeId(w1.getId())) {
 						wm = w1;
 					} else {
-						wm = new Way(FakeIdGenerator.makeFakeId());
+						wm = new Way(w1.getOriginalId());
+						wm.setFakeId();
 						wm.getPoints().addAll(points1);
 						beginMap.put(points1.get(0), wm);
 					}
@@ -1048,8 +1050,8 @@
 				log.info("clipping", segment);
 				toBeRemoved.add(segment);
 				for (List<Coord> pts : clipped) {
-					long id = FakeIdGenerator.makeFakeId();
-					Way shore = new Way(id, pts);
+					Way shore = new Way(segment.getOriginalId(), pts);
+					shore.setFakeId();
 					toBeAdded.add(shore);
 				}
 			}
@@ -1170,7 +1172,8 @@
 		for (Way w : islands) {
 
 			if (!FakeIdGenerator.isFakeId(w.getId())) {
-				Way w1 = new Way(FakeIdGenerator.makeFakeId());
+				Way w1 = new Way(w.getOriginalId());
+				w1.setFakeId();
 				w1.getPoints().addAll(w.getPoints());
 				// only copy the name tags
 				for (Entry<String, String> tagEntry : w.getTagEntryIterator()){
@@ -1249,7 +1252,8 @@
 					points.add(pStart);
 					
 					if(!FakeIdGenerator.isFakeId(w.getId())) {
-						Way w1 = new Way(FakeIdGenerator.makeFakeId());
+						Way w1 = new Way(w.getOriginalId());
+						w1.setFakeId();
 						w1.getPoints().addAll(w.getPoints());
 						// only copy the name tags
 						for (Entry<String, String> tagEntry : w.getTagEntryIterator()){
@@ -1265,8 +1269,13 @@
 						seaRelation.addElement("inner", w);
 					}
 				} else if(allowSeaSectors) {
-					long seaId = FakeIdGenerator.makeFakeId();
-					Way sea = new Way(seaId);
+					Way sea;
+					if (seaRelation != null) {
+						sea = new Way(seaRelation.getOriginalId());
+						sea.setFakeId();
+					}
+					else
+						sea = new Way(FakeIdGenerator.makeFakeId());
 					sea.getPoints().addAll(points);
 					sea.addPoint(new Coord(pEnd.getLatitude(), pStart.getLongitude()));
 					sea.addPoint(pStart);
@@ -1473,7 +1482,8 @@
 						if (FakeIdGenerator.isFakeId(w1.getId())) {
 							wm = w1;
 						} else {
-							wm = new Way(FakeIdGenerator.makeFakeId());
+							wm = new Way(w1.getOriginalId());
+							wm.setFakeId();
 							ways.remove(w1);
 							ways.add(wm);
 							wm.getPoints().addAll(points1);
