fix bug with validity checking of type definitions