fix format detection