Fixes courtesy of Jeff Hobbs.