Added some logging of errors