putting the locking back in agent