Implemented fix suggested by luke, bug 762 c#16, not quite working yet