Numerous bug fixes from testing in TQPortal