add traverse func and fix testing