Fixed z-each,add debug mode