I think you have to add:

  IFDTypeTags = true;

Otherwise the condition below might fail if there are not any other tags to be written in IFD0