BUG Better checking of existing files

[ref: CWPBUG-158]