Uncaught TypeError: Cannot set property 'groups' of undefined