added error handling to setup.source