Fixed some strange bugs in Firefox and Safari.