Fix the order of calls within createQueue. Flags comes before declare.