Solved global flags issue