Added length check for contour before box bound. Fixes #28