modified check check function faster