fix handling of Inf/-Inf in tojson

closes #6