Fixed bugs by Yusuf