updated with debug fixes