fixed few ifs