fix flag and mode