Fix: global name 'user' is not defined