flag script fixed