Fixed a bug with format determination