diff --git a/src/spfx.c b/src/spfx.c
index e8872cc..e96d267 100644
--- a/src/spfx.c
+++ b/src/spfx.c
@@ -142,10 +142,8 @@ void spfx_clear(void) {
 }
 
 static void spfx_destroy(SPFX* layer, int* nlayer, int spfx) {
-	int i;
 	(*nlayer)--;
-	for(i = spfx; i < *nlayer; i++)
-		memcpy(&layer[i], &layer[i+1], sizeof(SPFX));
+	memmove(&layer[spfx], &layer[spfx+1], (*nlayer-spfx)*sizeof(SPFX));
 }
 
 void spfx_update(const double dt) {