Fixed a bug in the traitsForTypeID method which only happened if the database hasn't been upgraded to include invTraits.