Added some debug options and fixed the error message