added some debugging / sanity checks to python gateway response handler