There is system in our brain which works like protecting ourselves (personal identity) from doing bad things. It is naturally made with our socialization process. It is like emotion, ego etc. It works and makes a effect of fear to do bad things. (it is psychological process ) It will create a situation like fear. Actually it is for protecting one's personal image in the society, getting better impression among the surrounding people, relatives, and friends (especially people whom we respect, love, accept ext....)
Everybody will have such kind of natural protective wall in our mind (brain) which tempt to protect us from doing bad things, bad activities etc. It only creates some situation which effects like fear. But it cannot compel the individual to follow are good practices, avoid bad things. It only creates a fear effect. A sort of fear about losing social acceptance, fear, respect and fear of somebody looks down upon us, or if we were caught by people by doing bad things.
Due to this feature, we all have a possibility to do bad things when we are alone, If our bad mind tempt to do some bad things, it will give assurance to that system (Good mind- which can be called as our conscious mind) that now there is nobody to watch what we do, or nobody will know about your secret practice, Then we will be released from the influence of our conscious mind (which control us from doing bad things) and do bad things.