IMO, disable interrupt before counting will solve the problem, but there's certainely other way ...See section 9.3 of the PBP manual. It must point you in the right direction.

BTW wich PIC are you using ? you can look in the according PBPPICXXX.LIB to see what value are use in COUNT. Try R1 and W.

regards