A better fix suggested from Randy's code review.