fix a null pointer exception during file downloading