Fix nullpointerexception
Filewriter