fix if contition bug