bug fix and add a new example program for functions