[BUGFIX] Add check if $fileObject is a correct instance