Added error reporting