Use return value to check for success instead of indirect error. Fixes #34.