fixed deadlock bug, changed queue to stack