Avoiding Contract Loopholes