slice check in wrong place