fixed the bugs in there that crashed the program.