added null check to addFiles() method