add MC loop + asserts and one bug fix