Better JSON tests, bug fixes.

Some good fixes regarding comments.
#2660