Fix various bugs so that it runs to completion with success