some exception handling tweaks.