Added enhanced error reporting.