fix gaia directory's bugs and coding optimize.