bug in marginals fixed