added more defensive format tracking