Fix bugs introduced at lunch time.
Also took the opportunity to add a more useful demo method to the API.