fixed reliance on getting img dir without setting filename