fixed osx build; some functions were returning error codes still, changed them to throw exceptions as well