Added a missing check. New QAgent class now works fully