added threshold to reject rectangles of 0 width