Surplus narrows in July as imports rebound