improved error handling of build target