add error debugging to script