Fix some pattern matching bugs
fix ellipsis matching on empty lists
add pattern tests