Fix ticket #36 (patch by Darryl Shpak).