Fix drawing in Firefox (fixes #628)