fixed bug with fname