flags, header, small fixes