fixed error in program, tex nearly finished