fixed the boundary check in cascade classifier not to run out of the buffer