a few fixes; added some json functions