replace missing foreach lost during cleanup after queryDB() addded