some debug fixes