make sure opts is not 'undefined'/null

I was seeing errors