Why do conditions work in Firefox but not in Chrome and Safari?