fixing some indices in rotate & merge