modified to solve file not found problem