improving json checking