1. Supervise and manage their environment to prevent them from doing things that you do not want them to build into habit.
2. Teach them the things that you do want them to learn how to do. Attempting to teach them not to do an unwanted behaviour doesn't usually work very well; teaching them what to do instead works much better.
3. When you're in public, have a plan to get out of Dodge in case their behaviour starts to deteriorate. Small beings may not be able to tell you when their environment becomes too hard for them to deal with; you either need to be on top of that shit, or accept that sometimes you'll miss the signs and it'll be better for the both of you to leave ASAP.