replace malloc to new