additional test and some fixes to handle trees