fix error when opts is null