fixed side effect with logging