fixed isDyckPath function