debugged outputtopk