fixed bug where flag value not converted to int properly