fix funtion of main example BUG