added debug lines to fix the error