Use self instead of MemoryQueue.this
Fix totalTasks + add more tests for MemoryQueue