Fix build state saving bug.