trying to catch where an error might happen so instrumented some places with debug statements