Change append function to work when records and setting ends. And bug fix.