markov: fix issues with class structure and callbacks not being called