Improved error handling in normal and deprecation mode.