fix null pointer exception for flush command and actually use
actualFormat variable