improved external exception handling