Patch by Kevin Ballard <kevin@sb.org>