added flexible deque test cases
fixed bug in gather