Reason can be simple here.

1. Count @ 4MHZ check pin state eache 20uSec, @20MHz 4uSec. can you send value of count to LCD or Serial and compare them after ???

2. Is your PIC support 20MHZ... PIC16F84-20 ??.. number after the dash is really important

3. Tie to ground every unused input pins

4. be sure of the 5V line... no noise. add the appropritate capacitor to the supply line