added check for re-build upon last failure