Related to PORTB, I can see that only the ANSEL register is different.

I have some doubt if the ANSEL needs to be set to 0 on this chip.

If that does not help, then perhaps you can try by disconnecting the driven load and check if the outputs are following your code intent.