applied @drbrain's emailed patch