One of the worst things to do when you own a bird is punish the bird. Yelling, screaming, or heaven forbid hitting the bird will only make your bird behavior worse and make them scared/aggressive towards you.
Birds need positive reinforcement. So reward the good behavior ignore the bad.
For example if your bird bites you instead of Yelling and shaking you hand simply follow these steps
1. gently grab the top of the beak to get them to let go if they have a hold still. If they have let go do not do they step.
2. Set the bird down or walk away if bird in a ready perched somewhere.
3. Ignore the bird. For about 5 - 10 minutes (Everyone so if it bites mom, dad do not pay attention to it either)
4. Resume normal activities.
After this as been done a few times it will learn that biting means it doesn't get any treats or attention.