Add firefox support and fix bugs