fixed issue with json encode.