Fixed bugs and improve some features