check typeof fname before check its length