bug fixing on JSON insert