fixed detect filetype problems