A couple of caveats apply. First, an amended complaint may not overcome statute-of-limitation issues unless the discovery rule applies and additional factual allegations support its application.
Second, be careful to make sure that the defendants did not file an answer first and then immediately file their motion to dismiss. If that is the case, you will need leave of the court to file the amended complaint because the amendment will not be “as a matter of course” unless you are still within 21 days of service of the initial complaint.
Although “[s]erving a responsive pleading terminate[s] the right to amend,” a motion to dismiss does not. Fed. R. Civ. P. 15(a), 2009 Advisory Committee Notes. As explained by the Advisory Committee, “a motion attacking the pleading” does not terminate the right to amend, “because a motion is not a ‘pleading’ as defined in Rule 7.” In the absence of undue delay, bad faith, dilatory motive on the part of the movant, repeated failure to cure deficiencies by amendments previously allowed, undue prejudice to the opposing party by virtue of allowance of the amendment, or futility of amendment, Rule 15(a)(2) directs the court to "freely give leave [to amend] when justice so requires." Underlying this rule is the principle that cases should be tried on their merits rather than the technicalities of pleadings.
If there are multiple defendants and multiple motions to dismiss are filed, then the amended complaint must be filed within 21 days of the first motion to dismiss. The Advisory Committee made clear that there "is no new 21-day period," and parties cannot add together, or make "cumulative," 21-day periods after opposing parties file separate responsive pleadings or motions to dismiss at different times.
Next time you see opposing counsel who filed the initial motion to dismiss, thank them for giving you a roadmap for a better complaint.