Improve ftdetect script