fixes and improved attribute error for agents