Door locks in my Scion 2005 xB1 are Irrational

The door locks on my XB1 have a mind of their own. Sometimes they activate all by themselves. Other times they won’t activate at all. It doesn’t matter whether I use the switch on the inside of the door or the remote control. I have been locked in/out several times.
Any idea?

A bad BCM can cause that problem.


The power locks activate and don’t allow you to manually unlock the door? In other threads you claimed that the power locks are inoperative (same problem as others).