fix "debug debug", use new algorithm