Added better error reporting.