fixed get_joints for cases where some states are never visited, added number of BMs to get_marginals, added regression test