Fix "Undefined variable: file_extension" problem