diff --git a/main/audiohook.c b/main/audiohook.c
index 2cba2de6e2851e00b15d4bb7db400cf969b042bc..04a379fefe190042c5fd52ca00e42e76d4e341cb 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -950,7 +950,9 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
 	 * rely on actual media being present to do things.
 	 */
 	if (!middle_frame->data.ptr) {
-		ast_frfree(middle_frame);
+		if (middle_frame != start_frame) {
+			ast_frfree(middle_frame);
+		}
 		return start_frame;
 	}
 
diff --git a/main/plc.c b/main/plc.c
index b649357dcd6ce9b690f71b0aeb7a2f4eab6dab7f..739f7276d70e24d62a29869fa3388a6b11e3c624 100644
--- a/main/plc.c
+++ b/main/plc.c
@@ -96,7 +96,7 @@ static void normalise_history(plc_state_t *s)
 	if (s->buf_ptr == 0)
 		return;
 	memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr);
-	memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));
+	memmove(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));
 	memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t) * s->buf_ptr);
 	s->buf_ptr = 0;
 }