Derived type bugfix