add check for a not existing thread
Merge pull request #194 from mehlis/master

add check for a not existing thread