Fixing some sloppy bugs.

Should help with #328.