Fixed #6436 #5596 and added threaded initialization

svn path=/trunk/tools/build/; revision=84739