After replacing the motor, always re-run the auto-tuning procedure on the drive. The new motor's characteristics will be slightly different from the old one (even same model number). On Yaskawa, run Fn005 auto-tuning. On Siemens, run the motor identification routine. Skip this and you'll get suboptimal performance or oscillation.