fix ordering, and case insensitive support