fixed issue #48, use proper exit code on error