corrected S and H flag