Resolve #40 in a more reliable way.