Don't call methods on undefined variables...

The old code tried to invoke a method on an undefined variable. If I change it to '$csr', as seems to be the intention, the error message disappears and the page loads normally.