Fixed errors when creating the simulator and its context.