Building an emergency fund might just keep your retirement plans on track.

Americans have been putting more into their retirement accounts, with 21 percent of workers saying they are saving more than they were last year, according to a recent Bankrate.com survey. Despite market volatility, 401(k) balances are up almost 2 percent from the first quarter, according to Fidelity data, to an average $88,900. Over the same period, average balances for long-term millennial savers rose to a record high of $92,900.