Added error debugging.