fixed firefox compat problems
merged with master