changed bool checking of variables