Fix "index ['User'] not defined" error