fix bug with detect file type