fix prepare bug