add header flip and fix