Fixed agent to work correctly