fixing some of bugs