Fixed problem with flags overwriting each other.