fixed print state function