fix two bugs about directory