Bug fix plus better logging.