some bug fixes.

Here's the two bug fixes I made last week. I'm afraid I didn't get them pushed to the respository until a few days ago.

This is the code we actually demo'ed on Monday night.