Can you test the program on different kind of PIC?

Also, without bootloader, it works OK without the magic PAUSE 5 line?

It does seem a RAM problem related to LONGs but Charles may help more.

Ioannis