#332 fixed incorrect checks