Made sure only file objects are valid