Tweaks to api controller which didn't get tested.