Pristine water conditions. A lot if water changes.
Good qulity pellets. Ones with garlic from Nls are the best for this imho.
Soak pellets in a 3% solution of Epsom salt, which equates to one tablespoon mixed in a half litre of water. Soak the pelletes, let them absorb the epsom solution and feed for five consecutive days.
If not better, repeat treatment after a couple of days.
But good water is paramount.