Fixing NPEs in rest api cartridge methods