make explicitly depth first and fix pushing