Bugfix for empty scan_history table