better error handling for build