Still trying to figure out why flags aren't set properly.