Thanks ttfn, this was the answer. I moved the interrupt clear instruction earlier in the handler and the problem disappeared.