fix overlapping memory bug when copying username