Fix the bug when opts is null