fix dequeue for empty

It is assumed to return `0` when no queue exist. But now `dequeue` returns `nil`.