Move flag setup logic to the constructor, should fix #23