Fix for bug #102. Thanks (blame!) go to ggn & dml for the idea. :-)