check filetype before reading in source