improved json error reporting