fixed simulator.m