FATAL ERROR(1): "Call to a member function generate_token() on null"