I don't know the details of either case but I have a suspicion, especially with the black bear example you mentioned, it has something to do with FOOD. Properly storing food will dramatically lower your chances of encountering a bear.