Fix "Uncaught TypeError: Cannot read property 'maxAge' of null"