fix mock logic, move some methods around, fix minor bugs