diff --git a/src/hybrid_encoder.c b/src/hybrid_encoder.c
index 881ef09ce56f3496742d6c51d4c4c5e05c5f22cc..a18dc13c64a87e31f804e408b7000461f2337943 100644
--- a/src/hybrid_encoder.c
+++ b/src/hybrid_encoder.c
@@ -46,7 +46,7 @@ HybridEncoder *hybrid_encoder_create()
 	HybridEncoder *st;
 	int ret, encSizeBytes;
 
-	st = malloc(sizeof(HybridEncoder));
+	st = calloc(sizeof(HybridEncoder), 1);
 
     /* Create SILK encoder */
     ret = SKP_Silk_SDK_Get_Encoder_Size( &encSizeBytes );
@@ -77,6 +77,7 @@ HybridEncoder *hybrid_encoder_create()
 
 	st->mode = MODE_HYBRID;
 	st->bandwidth = BANDWIDTH_FULLBAND;
+	st->vbr_rate = 0;
 
 	return st;
 }
@@ -84,6 +85,7 @@ HybridEncoder *hybrid_encoder_create()
 int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
 		unsigned char *data, int bytes_per_packet)
 {
+    int i;
 	int ret=0;
 	SKP_int16 nBytes;
 	ec_enc enc;
@@ -94,7 +96,7 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
 
 	if (st->mode != MODE_CELT_ONLY)
 	{
-	    st->encControl.bitRate               = (bytes_per_packet*50*8+4000)/2;
+	    st->encControl.bitRate = (bytes_per_packet*50*8+6000)/2;
 	    /* Call SILK encoder for the low band */
 	    nBytes = bytes_per_packet;
 	    ret = SKP_Silk_SDK_Encode( st->silk_enc, &st->encControl, pcm, 960, &enc, &nBytes );
@@ -115,9 +117,19 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
 
 	if (st->mode != MODE_SILK_ONLY)
 	{
+	    short buf[960];
+
+	    for (i=0;i<ENCODER_DELAY_COMPENSATION;i++)
+	        buf[i] = st->delay_buffer[i];
+        for (;i<960;i++)
+            buf[i] = pcm[i-ENCODER_DELAY_COMPENSATION];
+
+        celt_encoder_ctl(st->celt_enc, CELT_SET_PREDICTION(1));
 	    /* Encode high band with CELT */
 	    /* FIXME: Do some delay compensation here */
-	    ret = celt_encode_with_ec(st->celt_enc, pcm, NULL, frame_size, data, bytes_per_packet, &enc);
+	    ret = celt_encode_with_ec(st->celt_enc, buf, NULL, frame_size, data, bytes_per_packet, &enc);
+	    for (i=0;i<ENCODER_DELAY_COMPENSATION;i++)
+	        st->delay_buffer[i] = pcm[960-ENCODER_DELAY_COMPENSATION+i];
 	} else {
 	    ec_enc_done(&enc);
 	}
diff --git a/src/hybrid_encoder.h b/src/hybrid_encoder.h
index 66ef4dbe6f83f8cc4bbc5e4308bc2d81c91dca95..dc10d3ad83b7eec62cc941752d793ae1e6b3402e 100644
--- a/src/hybrid_encoder.h
+++ b/src/hybrid_encoder.h
@@ -36,6 +36,9 @@
 #include "hybrid.h"
 #include "SKP_Silk_SDK_API.h"
 
+/* FIXME: This is only valid for 48 kHz */
+#define ENCODER_DELAY_COMPENSATION 130
+
 struct HybridEncoder {
 	CELTMode    *celt_mode;
 	CELTEncoder *celt_enc;
@@ -45,6 +48,8 @@ struct HybridEncoder {
     int          mode;
 	int          bandwidth;
     int          vbr_rate;
+
+    short        delay_buffer[ENCODER_DELAY_COMPENSATION];
 };