fixing bug and updating for rbd and markov