BUG: check for existence of files