Fix issues with changed JSON API

Plus some cosmetics