Added some error reporting