Why a bird does not fall from the tree while sleeping?

The bird's feet have tendons, like a hand, that grip things. When the bird sleeps, these tendons tighten, and grip a branch.