Improved handling for exceptional cases.