fix typo while checking boundary