fixed fav bugs and some undefined errors