bug fixes.  Tell me if this breaks anything