fixed Null Writer error