flush buffer, change restrict image h location
added try catch for json parsing