fixes wrong check for condition typecasting