Changed flagdata call to a tflagdata call.
Now the script will also process old-format data.