Fixed bugs all over the program.