diff --git a/src/Application/Modes/ProjectionMappingMode.cpp b/src/Application/Modes/ProjectionMappingMode.cpp
index c7465d1..0a34324 100644
--- a/src/Application/Modes/ProjectionMappingMode.cpp
+++ b/src/Application/Modes/ProjectionMappingMode.cpp
@@ -73,7 +73,9 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
 			break;
 		 }
 		 app->getCmdManager()->exec(
-			 new RmSurfaceCmd(app->getSurfaceManager()));
+			 new RmSurfaceCmd(
+				app->getSurfaceManager(),
+				app->getSurfaceManager()->getSelectedSurfaceIndex()));
 		 break;
 	 
 	 case 'p':
diff --git a/src/Commands/RmSurfaceCmd.cpp b/src/Commands/RmSurfaceCmd.cpp
index d997db1..9aebca8 100644
--- a/src/Commands/RmSurfaceCmd.cpp
+++ b/src/Commands/RmSurfaceCmd.cpp
@@ -3,15 +3,17 @@
 namespace ofx {
 namespace piMapper {
 
-RmSurfaceCmd::RmSurfaceCmd(SurfaceManager * sm){
+RmSurfaceCmd::RmSurfaceCmd(SurfaceManager * sm, int i){
 	_surfaceManager = sm;
 	_surface = 0;
+	_surfaceIndex = i;
 }
 
 void RmSurfaceCmd::exec(){
 	// Store the surface, this implies that the surfaceManager's
 	// removeSelectedSurface does not destroy the surface.
-	_surface = _surfaceManager->getSelectedSurface();
+	// The owner is being changed.
+	_surface = _surfaceManager->getSurface(_surfaceIndex);
 	_surfaceManager->removeSelectedSurface();
 }
 
diff --git a/src/Commands/RmSurfaceCmd.h b/src/Commands/RmSurfaceCmd.h
index 6d7d71a..d75805a 100644
--- a/src/Commands/RmSurfaceCmd.h
+++ b/src/Commands/RmSurfaceCmd.h
@@ -16,13 +16,14 @@ namespace piMapper {
 class RmSurfaceCmd : public BaseUndoCmd {
 
 	public:
-		RmSurfaceCmd(SurfaceManager * sm);
+		RmSurfaceCmd(SurfaceManager * sm, int i);
 		void exec();
 		void undo();
 
 	private:
 		SurfaceManager * _surfaceManager;
 		BaseSurface * _surface;
+		int _surfaceIndex;
 
 };