Added workaround for possible Math.Max Mozilla and Safari bug.