fix firefox issues (fix #160)

@wjwwood @tfoote Please review.