little better error handling in Main