Category substring check fixed