add functin check and take-while