Fixed bugs with program