CalculateFlags not working