change dir structure. fix bugs