Fix comparing uncomparable type error