Improving check for an "empty" program