Updated

Two astronauts cut short their spacewalk and hurried back to the safety of the international space station on Wednesday after a suit problem resulted in rising carbon dioxide levels for one of the men.

Mission Control notified the crew five hours into the spacewalk that the canister for removing carbon dioxide from Christopher Cassidy's suit did not seem to be working properly. Flight controllers wanted him back inside quickly. That meant fellow spacewalker David Wolf had to go back in early, too.

Their battery replacement work outside the space station was left unfinished. Only two of four new batteries ended up being installed.

• Click here for more photos.

• Click here for astronaut Mark Polansky's Twitter page.

• Click here for complete FOXNews.com space-shuttle coverage.

• Click here for NASA's live video feed.

• Click here to visit FOXNews.com's Space Center.

Cassidy immediately headed for the hatch. He waited there for Wolf, who was farther out on the space station. Their work site was on the far left side of the orbiting complex, along the framework that holds the huge solar wings and more than 150 feet from the hatch.

"I'm just going to sit here and I'm going to wait for Dave and enjoy the view," Cassidy said.

Both men were back inside and the spacewalk was over a half-hour after Mission Control's initial call to cut it short. It ended up lasting six hours, a half-hour shorter than planned.

It was the third spacewalk in five days for shuttle Endeavour's crew. Two more are planned, on Friday and Monday. More battery work had been planned for Friday, with a total of six new station batteries to be installed by mission's end.

Mission Control said the unfinished battery work from Wednesday would be squeezed into one of the next spacewalks.

Neither Cassidy nor Wolf — nor any of the 11 astronauts inside — sounded particularly stressed as they dropped everything and headed back in. Wolf noted that his idea for stringing safety tethers together, with minimal hookups in case of an emergency, "worked like a charm."

"Never thought we'd use it," he said as he made his way toward the hatch, hand over hand.

Until the suit trouble, the spacewalk had been progressing without any major problems, save for some stubborn bolts on the batteries. The astronauts were running behind, though, because of the difficult work. They had removed three of the 9-year-old batteries from the space station and plugged in two new ones, when they got the call to wrap it up.

These large nickel-hydrogen batteries are critical, storing the power collected by the space station's solar wings. The old batteries were launched in 2000. NASA is uncertain how long those original batteries might last and wants new ones installed before the old ones die.

The new batteries cost $3.6 million apiece.

All of the old batteries will be returned to Earth aboard Endeavour. The shuttle, in orbit for a week now, will undock from the space station on Tuesday. Landing is set for July 31.

As for the next shuttle launch, testing shows that the foam insulation on the fuel tank for Discovery looks to be attached properly. An unusual amount of foam came off the central portion of Endeavour's tank during liftoff last week, and NASA has been checking that region of Discovery's tank at Kennedy Space Center. More testing may be ordered up. Liftoff is targeted for no earlier than Aug. 21.