improved error handing.