fixing if comparison error