Index: generic/src/adt/bitmap.c
===================================================================
--- generic/src/adt/bitmap.c	(revision 152b2b0ca223d7a95abf0fbd5e89c977c114a9ce)
+++ generic/src/adt/bitmap.c	(revision 7669bcf004fbab71b35a1a9ec2b476fb2c698b7a)
@@ -67,5 +67,5 @@
 void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits)
 {
-	index_t i;
+	index_t i=0;
 	index_t aligned_start;
 	count_t lub;		/* leading unaligned bits */
@@ -79,4 +79,12 @@
 	amb = bits > lub ? bits - lub : 0;
 	tab = amb % 8;
+	
+	if ( start + bits < aligned_start ) {
+	    /*
+	    * Set bits in the middle of byte
+	    */
+	    bitmap->map[start / 8] |= ((1 << lub)-1) << (start&7);
+	    return;
+	}
 	
 	if (lub) {
@@ -109,5 +117,5 @@
 void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits)
 {
-	index_t i;
+	index_t i=0;
 	index_t aligned_start;
 	count_t lub;		/* leading unaligned bits */
@@ -121,4 +129,14 @@
 	amb = bits > lub ? bits - lub : 0;
 	tab = amb % 8;
+
+	if ( start + bits < aligned_start )
+	{
+	    /*
+	    * Set bits in the middle of byte
+	    */
+	    bitmap->map[start / 8] &= ~(((1 << lub)-1) << (start&7));
+	    return;
+	}
+
 
 	if (lub) {
