Add solutions for hw1 and hw2; fix minor bugs.