Yeah, I used to do that. I'm a dog lover and I know how to approach them, but at night, it hard to see them and you will just notice them when they started to bark and chased you.
I consider myself very lucky at that time. I didn't even know what to do. I just stopped out of instinct. I also thought that not moving could be effective. I'm grateful that it was.