Fixing queue scheduling bug