added some debug code, when needed