Adding a few bug fixes from Gabe.