Fix some code errors in prepare disk script