toJSON uses wrong params