fixed bufferoverlfow add addlog function