Gave up and resorted to bit32 lib to handle bitflags