Model validation and export now works with threads. (issue #265)