corrected solution to problem 2; fixed some other typos