Make sure 'item' variable is set when using first_available_file

Fixes #8220