almost fixed all errors