Changing use of error functions so it builds on os x and uses standard
clunky sonLib functions.