moved check for supported language to the beginning
fixed obtaining of the filetype descriptor