Fixed Bug in Write Index