fix error handling in bad builds