How to keep smart dog out of trouble