bug fix: file not writen from pattern matching failure