fixed incorrect check