explicitly set mode flags in the Hat ctor
add Hat mode switching tests