Minor bug in comparison function