added nonregular boundary checking