Fixed issue with traverse and reverse order