changed the checking method