Added better typeresolution for config and serialization.

instead of checking type.gettype for null result, that is now handled in a helper method with a consistent error message.
Merge pull request #505 from rogeralsing/validate-type-resolution-233

validate-type-resolution-233- merging this. it is only refactoring, no new features