find target fix

Made it so that the code would not error out.
the has_key does not exist so it was removed
file was also not defined so I fixed that