add callback function for certain views and fixed some bug