problem looks like it's with cast equality, so print debugging strings there