Alvin's debug fixes