Added optimizer fix originating from Ullrich von Bassewitz prepared by Greg King.