Fix queue error when commands are added concurrently. Fixes #54.