bug fix: push to right and pop left