Fix a couple bugs I created when I merged shwetas code.