Fixing if check error