fix no element tap bug and adjust traversal algorithm