fix null pointer in resultwriter