change unnecessary char array to string and solve related problem