Rebuilding memory units