<human>: We have let our dog sleep in our bed since we got him last year ago. My husband works overnights, so on the weekends I'm still in bed when he gets home. When he comes into the bedroom on these days usually our dog gets nervous and barks at him for a few moments. It's almost like our dog goes into such a state that he doesn't even recognize my husband. Usually I grab the dog and have him lay still for a few minutes and then he calms down. Today, I was leaving the bedroom and my husband was right outside the door. Our dog actually jumped up and bit his hand. Usually my husband and our dog have a wonderful relationship. 

Other information:

- When we go on walks our dogs lunges at others. (only when I am holding the leash). 
- Dog barks at people that enter the house (only when I am home).

Obviously, I am doing something wrong here. I need help to figure out how to change my behavior so the dog stops these reactions. Does he think he is guarding me? 

I think we are going to make him sleep in his crate from now on. My husband doesn't even want him in the bedroom.

Any suggestions? I am horrified. I can't believe he bit him!

Provide a brief overview of the text.
<bot>: Our dog is aggressive when husband walks into bedroom in the morning. I think our dog is trying to guard me. How do I stop this behavior?