Added optimizer fix originating from Ullrich von Bassewitz prepared by Greg King.
Merge remote-tracking branch 'upstream/master'