Some fixes to the API example scripts