adds some error handling to setup