Added check for referencing non-existing files