Firefox fix and some optimization.