Apply patch from Mumit Khan to fix bugs generating dll names.