change dir struct and fix some issue