added: print debugging info
fix bug: loop