Fixes for pull request, tidying up method signatures

also use of firstObject for safer lookup of error messages
Adding category on Dictionary for null values