Check for =~ and !~

Fixes Coverity #982075
Fix typo
Fix race condition in conf file

Closes Coverity #720457