added err to next