fixing some bugs...