Fix undefined index for ds_names in type classes

Use the empty function to access this->ds_names to fix some 'undefined index' php notices. Those patches may partially fix #17.