Help with motion activated servo please.

Can you see where your code differs from this ?

It doesn't need fixing.
Read the source.