fixing some major bugs