Fixes issue #186.
Checks for COmponent Type before casting.
Fixes issue #185
Checking for legal features of SubprogramGroup and Subprogram in feature
groups.