Try and make sure that 'rebuild' exits on error