ugly debug code