Typos
fixed some changed variables and errors detected by Visual C++