remove debugging statement
add cjson checking
same fixes committed elsewhere, but hanged if I know how to do it right yet...